<!DOCTYPE html>
<html lang="en">
<head>
    <title>公共平台 </title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!-- 样式文件的引入 -->
    <link href="commons/css/style.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" type="text/css" href="commons/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="commons/themes/icon.css">
    <!-- jqueryUI JS文件的引入 -->
    <script type="text/javascript" src="commons/js/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="commons/js/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="commons/js/easyui-extends-validate.js"></script>
    <!-- jqueryUI国际化 -->
    <script type="text/javascript" src="commons/js/easyui-lang-zh_CN.js"></script>
    <!-- 开发使用的公用js方法 -->
    <script type="text/javascript" src="commons/js/common.js"></script>
	<!-- 开发国际化的引用，主要完成后台信息在前台提示的国际化，一定要放在最后 -->
	<script type="text/javascript">var ctx = '/comm-user-auth-server';var actionExt = "action";var i18n = new Object();</script>
	<script src="commons/js/i18n/message_zh_CN.js" type="text/javascript"></script>
  </head>
  
  <body>
    <div class="easyui-layout" data-options="fit:true,border:true" >
    	<div data-options="region:'north',border:true" style="overflow: hidden;">
			<div  class="queryContent" style="height: 66px;">
				<form name="searchForm" id="searchForm" method="post" action="" style="display: none; ">
				<table class="queryTable" >
					<tbody>
						<tr>
							<th width="100">所属模块</th>
							<td width="10%">
							<input id="selSysCodeCombobox" name="sysCode" class="easyui-combobox" data-options="
					        panelHeight:'auto',
					        valueField: 'id',
					        textField: 'text',
					        width:'150px',
					        animate:true">
							</td>
							<th width="100">执行结果</th>
							<td width="10%">
							<select class="easyui-combobox" name="result" style="width:80px;" data-options="panelHeight:70">
							<option value="-1">全部</option>
							<option value="1">成功</option>
							<option value="0">失败</option>
							</select>
							</td>
							<th width="100">操作者</th>
							<td width="10%">
							<input class="easyui-validatebox" id="oper" type="text" name="oper" maxlength="20" style="width:120px"></input>
							</td>
							<th width="100">操作时间</th>
							<td width="10%">
							<input id="startTime" class="easyui-datetimebox" type="text" name="startTime" data-options="validType:['dateTimeLessCompare[\'endTime\']']" maxlength="20" style="width:140px"/>-<input id="endTime" class="easyui-datetimebox" type="text" data-options="validType:['dateTimeMoreCompare[\'startTime\']']" name="endTime" maxlength="20" style="width:140px"/></td>
							</tr>
							<tr>
							<th width="100">操作类型</th>
							<td width="10%">
							<select class="easyui-combobox" name="opType" style="width:80px;" data-options="panelHeight:100">
							<option value="-1">全部</option>
							<option value="select">查询</option>
							<option value="update">修改</option>
							<option value="insert">插入</option>
							<option value="delete">删除</option>
							<option value="other">其他</option>
							</select>
							</td>
							<th width="100">客户端IP</th>
							<td width="10%">
							<input class="easyui-validatebox" id="oper" type="text" name="ip" maxlength="20" style="width:120px"></input>
							</td>
							<th width="100">事件类型</th>
							<td width="10%">
							<select class="easyui-combobox" name="logType" style="width:100px;" data-options="panelHeight:70">
							<option value="">全部</option>
							<option value="system">系统级事件</option>
							<option value="business">业务级事件</option>
							</select>
							</td>
							<th width="100">日志内容</th>
							<td width="10%">
							<input class="easyui-validatebox" type="text" name="logContent" maxlength="100" style="width:280px"></input></td>
							<td align="right" width="10%"><a href="javascript:void(0);" class="easyui-linkbutton" id="search"  plain="true">查询</a>
							<a href="javascript:void(0);" class="easyui-linkbutton" id="resetSearch" plain="true">清空</a><a href="javascript:void(0);" class="easyui-linkbutton" onclick="logBack(2);" plain="true">备份日志</a></td>
						</tr>
					</tbody>
				</table>
				</form>
			</div>
			</div>
		<div data-options="region:'center',border:true" >
			<table id="listTable" class="easyui-datagrid" 
				data-options="singleSelect:true,method:'post',rownumbers:true,fit:true,fitColumns:true,border:false,
					pagination:true,remoteSort:true,multiSort:true,striped:true,url:'/comm-user-auth-server/log/findPageLog'">
				<thead>
					<tr>
						<th data-options="field:'sysCode',width:20,sortable:true,title:'所属模块'"></th>
						<th data-options="field:'operName',width:20,sortable:true,title:'操作者登录名'"></th>
						<th data-options="field:'opTime',width:20,sortable:true,title:'操作时间'" align="center"></th>
						<th data-options="field:'opType',width:20,sortable:true,title:'操作类型',formatter: function(value,row,index){
								if (value != '') {
									if (value == 'insert') {
										return '插入';
									} else if (value == 'delete') {
										return '删除';
									} else if (value == 'select') {
										return '查询';
									} else if (value == 'update') {
										return '修改';
									} else if (value == 'other') {
										return '其他';
									}
								}
							}" align="center"></th>
						<th data-options="field:'logType',width:20,sortable:true,title:'事件类型',formatter: function(value,row,index){
								if (value != '') {
									if (value == 'system') {
										return '系统级事件';
									} else if (value == 'business') {
										return '业务级事件';
									}
								}
							}" align="center"></th>
						<th data-options="field:'logContent',width:60,sortable:true,title:'日志内容'"></th>
						<th data-options="field:'opEntity',width:80,sortable:true,title:'操作参数',formatter: function(value,row,index){
								return '<font title=\''+value+'\'>'+value+'</font>';
							}"></th>
						<th data-options="field:'exeTime',width:20,sortable:true,title:'执行时间（毫秒）'"  align="center"></th>
						<th data-options="field:'resultValue',width:20,sortable:true,title:'执行结果'"  align="center"></th>
						<th data-options="field:'ip',width:20,sortable:true,title:'客户端IP'"  align="center"></th>
					</tr>
				</thead>
			</table>
		</div>
	</div>
</body>
	<script type="text/javascript">
		//初始化表格对应的js对象
		var paramObj;
		$(function() {
			//初始化表格对象数据
			paramObj = new initParams(
					{
						paramObjName : 'paramObj',//表格对应的实体对象名称，好区分多个表格情况下的对象
						tableId:'listTable',
						searchID:'search',
						resetSearchID:'resetSearch',
						searchFormID:'searchForm',
						ctx:'/comm-user-auth-server'
					});
			//初始化查询
			init(paramObj);
			 //下拉选项初始化
	        $.getJSON('/comm-dictionary-server/dictionaryManage/listSys?parentValue=sys_code',function(jsonData){
	            $('#selSysCodeCombobox').combobox({
	                data:jsonData.data,
	                valueField:'value',
	                textField:'name'
	            });
	        });
		});
		
		function logBack(flag){
			$.messager.confirm('提示',"当前备份六个月前的数据，您确定要备份这些数据吗？",function(result){
				if(result){
					$.ajax({
						type: "get",
						timeout:20000,
						url:  '/comm-user-auth-server/log/logBack?flag=' + flag,
						success: function(resultData,res){
							if(resultData.success == true){
								$.messager.alert('提示','数据备份完成！','info',function(){
									$('#'+paramObj.tableId).datagrid('reload');
								});
							}
						},
						error: function(res){
							var msn = ''||i18n[''];
							$.messager.alert('提示',i18n.requestError,'error');
						}
					});
				}});
		}
	</script>
  </body>
</html>
